<template>
  <div class="healthInfo">
    <van-cell
      title="健康资讯"
      is-link
      :border="false"
    />
    <van-tabs
      v-model="active"
      @click="getItem"
    >
      <van-tab
        :title="item.className"
        v-for="item in healthInfoList"
        :key="item.classId"
      >
        <template>
          <div
            class="card-box"
            v-for="art in item.articleList"
            :key="art.id"
          >
            <div class="vancard">
              <div class="card-text">
                <p class="tittle">{{art.articleName}}</p>
                <p class="timer">{{art.createTime}}</p>
              </div>
              <div>
                <img
                  :src="art.thumbnail"
                  alt=""
                >
              </div>
            </div>
          </div>
        </template>
      </van-tab>

    </van-tabs>
  </div>
</template>
<script>
import * as http from "@/api/home.js";

export default {
  data() {
    return { healthInfoList: "", active: "0" };
  },
  methods: {
    async getHealthInfo() {
      var res = await http.getHealthInfo();
      this.healthInfoList = res.data.data;
      console.log(this.healthInfoList);
    },
    getItem(item) {
      console.log(item);
    }
  },
  created() {
    this.getHealthInfo();
  },
};
</script>
<style lang="scss">
.card-box {
  padding: 12px;
}
.vancard {
  display: flex;
  justify-content: space-between;
  align-items: center;
  // padding: 12px;
  img {
    height: 69px;
    width: 93px;
  }
}
.tittle {
  // height: 0.986667rem;
  line-height: 0.533333rem;
  color: #333;
  font-size: 0.373333rem;
  font-weight: 700;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.timer {
  margin-top: 0.48rem;
  line-height: 1;
  font-size: 0.32rem;
  color: #999;
  overflow: hidden;
}
.van-card__num {
  .num-desc {
    position: absolute;
    left: 0px;
    bottom: 10px;
  }
}
</style>
